python print list as string

34

list1 = [1, 2, 3]
str1 = ''.join(str(e) for e in list1)
list1 = ['1', '2', '3']
str1 = ''.join(list1)
>>> L = [1,2,3]       
>>> " ".join(str(x) for x in L)
'1 2 3'

Comments

Submit
0 Comments